<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>测试jQuery-validate</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<script type="text/javascript" src="js/jquery.js" ></script>
		<script type="text/javascript" src="js/bootstrap.min.js" ></script>
		
		<script type="text/javascript" src="js/jq-validate/jquery.validate.js" ></script>
		<script type="text/javascript" src="js/jq-validate/additional-methods.js" ></script>
		<script type="text/javascript" src="js/jq-validate/messages_zh.js" ></script>
		
		<script type="text/javascript" src="js/nojs.js" ></script>
		<script>
			
			$(function(){
				var r = $("input[name=reg]").data("ruleRegex");
				console.info("r=" + r);
				var reg = new RegExp(r);
				console.info(reg.test("23"));
			});
		</script>
	</head>
	<body>
		<form class="form-horizontal validate" role="form" data-debug="true">
			<div class="form-group">
				<label class="col-md-3 col-sm-3 control-label">姓名：</label>
				<div class="col-md-5 col-sm-5">
					<input class="form-control" type="text" name="name" data-rule-required="true" placeholder="您的姓名" />
				</div>
				<label class="col-sm-4 col-sm-4 help-inline form-control-static" for="title"></label>
			</div>
			
			<div class="form-group">
				<label class="col-md-3 col-sm-3 control-label">文件：</label>
				<div class="col-md-5 col-sm-5">
					<input  type="file" data-rule-accept="image/*" name="pic" placeholder="文件" />
				</div>
				<label class="col-sm-4 clo-md-4 help-inline"></label>
			</div>
			
			<div class="form-group">
				<label class="col-md-3 col-sm-3 control-label">测试：</label>
				<div class="col-md-5 col-sm-5">
					<input class="form-control" type="text" name="test" data-rule-test="true" data-msg-test="hahaha" placeholder="除非你输入test" />
				</div>
				<label class="col-sm-4 col-sm-4 help-inline form-control-static" for="title"></label>
			</div>
			
			<div class="form-group">
				<label class="col-md-3 col-sm-3 control-label">正则：</label>
				<div class="col-md-5 col-sm-5">
					<input class="form-control" type="text" name="reg" data-rule-regex="\d"  placeholder="正则" />
				</div>
				<label class="col-sm-4 col-sm-4 help-inline form-control-static" for="title"></label>
			</div>
			
			<div class="clearfix form-actions">
			<div class="col-sm-offset-3 col-sm-9">
				<button type="submit" class="btn btn-primary">
					<i class="icon-ok bigger-110"></i> 确定提交
				</button>

				<button type="button" class="btn btn-info">
					<i class="icon-undo bigger-110"></i> 取消返回
				</button>
			</div>
		</div>
		</form>
		
	</body>
</html>
